/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.subway.persistencias;

import java.io.Serializable;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Héctor <UFG>
 */
@Entity
@Table(name = "cat_telefono", catalog = "bd_subway", schema = "")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "CatTelefono.findAll", query = "SELECT c FROM CatTelefono c"),
    @NamedQuery(name = "CatTelefono.findByTelId", query = "SELECT c FROM CatTelefono c WHERE c.telId = :telId"),
    @NamedQuery(name = "CatTelefono.findByTelNumero", query = "SELECT c FROM CatTelefono c WHERE c.telNumero = :telNumero")})
public class CatTelefono implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "telId")
    private Integer telId;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 10)
    @Column(name = "telNumero", nullable = false, length = 10)
    private String telNumero;
    @JoinColumn(name = "telPropietarioId", referencedColumnName = "personaId", nullable = false)
    @ManyToOne(optional = false)
    private Persona telPropietarioId;

    public CatTelefono() {
    }

    public CatTelefono(Integer telId) {
        this.telId = telId;
    }

    public CatTelefono(Integer telId, String telNumero) {
        this.telId = telId;
        this.telNumero = telNumero;
    }

    public Integer getTelId() {
        return telId;
    }

    public void setTelId(Integer telId) {
        this.telId = telId;
    }

    public String getTelNumero() {
        return telNumero;
    }

    public void setTelNumero(String telNumero) {
        this.telNumero = telNumero;
    }

    public Persona getTelPropietarioId() {
        return telPropietarioId;
    }

    public void setTelPropietarioId(Persona telPropietarioId) {
        this.telPropietarioId = telPropietarioId;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (telId != null ? telId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof CatTelefono)) {
            return false;
        }
        CatTelefono other = (CatTelefono) object;
        if ((this.telId == null && other.telId != null) || (this.telId != null && !this.telId.equals(other.telId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "org.subway.persistencias.CatTelefono[ telId=" + telId + " ]";
    }
    
}
